/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * IndexPropertiesDialog.java
 *
 * Created on Dec 25, 2009, 9:26:10 PM
 */
package fasea.ui.properties;

import fasea.model.IndexingFolder;
import fasea.model.IndexingFolderList;
import java.awt.event.ActionListener;
import java.io.File;
import java.util.List;

/**
 *
 * @author gvasil
 */
public class PropertiesViewImpl extends javax.swing.JDialog implements PropertiesView{
    
    /**
     * Creates new form IndexPropertiesDialog
     */
    public PropertiesViewImpl(java.awt.Frame parent) {
        super(parent, true);
        initComponents();
        //center dialog
        this.setLocationRelativeTo(null);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        indexPropertiesPanel = new fasea.ui.properties.PropertiesPanel();
        jSeparator1 = new javax.swing.JSeparator();
        okButton = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Index Properties");
        setIconImage(null);
        setIconImages(null);
        setResizable(false);

        okButton.setText("OK");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.TRAILING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap(659, Short.MAX_VALUE)
                .addComponent(okButton)
                .addContainerGap())
            .addComponent(indexPropertiesPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(indexPropertiesPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 478, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(okButton)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    public fasea.ui.properties.PropertiesPanel indexPropertiesPanel;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JButton okButton;
    // End of variables declaration//GEN-END:variables

    public void addOkButtonActionListener(ActionListener listener){
        okButton.addActionListener(listener);
    }
    
    public void addAddFolderButtonActionListener(ActionListener listener){
        indexPropertiesPanel.getAddFolderButton().addActionListener(listener);
    }
    
    public void addRemoveFolderButtonActionListener(ActionListener listener){
        indexPropertiesPanel.getRemoveFolderButton().addActionListener(listener);
    }
    
    public void addStartButtonActionListener(ActionListener listener){
        indexPropertiesPanel.getStartButton().addActionListener(listener);
    }
    
    public void addStopButtonActionListener(ActionListener listener){
        indexPropertiesPanel.getStopButton().addActionListener(listener);
    }
    
    public void setIndexDirectory(File indexFolder){
        indexPropertiesPanel.setIndexDirectory(indexFolder);
    }
    
    public void setLastIndexed(String lastIndexed){
        indexPropertiesPanel.setLastIndexed(lastIndexed);
    }

    public void setIndexingFolders(IndexingFolderList folders) {
        indexPropertiesPanel.setIndexingFolders(folders);
    }
    
    public void setIndexAlertIcon() {
        indexPropertiesPanel.setIndexAlertIcon();
    }

    public void setIndexOKIcon(){
        indexPropertiesPanel.setIndexOKIcon();
    }

    public void setIndexRunningIcon() {
        indexPropertiesPanel.setIndexRunningIcon();
    }
    
    public void enableStartButton(boolean started){
        indexPropertiesPanel.enableStartButton(started);
    }
    
    public void setIndexerInfoText(String text){
        indexPropertiesPanel.setIndexerStatusText(text);
    }

    public IndexingFolderList getIndexingFolders() {
        return indexPropertiesPanel.getIndexingFolders();
    }

    public void setIndexSize(long size) {
        indexPropertiesPanel.setIndexSize(size);
    }

    public void setIndexedDocumentsCount(int indexedDocumentsCount) {
        indexPropertiesPanel.setIndexedDocumentsCount(indexedDocumentsCount);
    }
}
